/***************************************************************
*  Copyright (c) 2007 by GroupMe! Team (www.groupme.net)
*  All rights reserved.
*
*  This file is part of the GroupMe! Project. Source code of 
*  this project is closed and redistribution of this code is
*  prohibited. 
*  
*  Contact: http://www.groupme.net
*
*  This copyright notice MUST APPEAR in all copies of the file!
***************************************************************/
package net.groupme.utils.sql;

import java.sql.ResultSet;
import java.sql.SQLException;

import javax.sql.DataSource;

import org.springframework.jdbc.object.MappingSqlQuery;

/**
 * 
 * created on Jul 26, 2007
 * 
 * This is a small helper call that returns the query result as an integer. 
 * 
 * @author Fabian Abel, <a href="mailto:abel@l3s.de">abel@l3s.de</a>
 * @author last edited by: $Author: fabian $
 * 
 * @version $Revision: 1.1 $ $Date: 2007-07-26 11:06:23 $
 */
public class GetIntQuery extends MappingSqlQuery {
	private String columnName;
	public GetIntQuery(DataSource ds, String query, String columnName){
		super(ds, query);
        this.columnName = columnName;
        compile();
    }
    protected Object mapRow(ResultSet rs, int rowNum) throws SQLException {
        return rs.getInt(columnName); 
    }
}